package com.fileupload.upload.strategy;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 日期归档策略
 * 按照yyyy-MM-dd格式创建日期目录
 */
public class DateArchiveStrategy implements ArchiveStrategy {
    
    private static final Logger logger = LoggerFactory.getLogger(DateArchiveStrategy.class);
    private static final String DATE_FORMAT = "yyyy-MM-dd";
    
    @Override
    public String buildArchivePath(String monitorDir, File file) {
        // 创建yyyy-MM-dd格式的日期目录
        String dateDir = new SimpleDateFormat(DATE_FORMAT).format(new Date());
        logger.info("[日期归档策略] 生成日期目录: {}", dateDir);
        return dateDir + "/";
    }
}